<!DOCTYPE HTML>
<html lang="zh-CN" class="ax-vertical-centered" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>图书馆管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-admin-theme.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-admin-theme.css}">
    <script th:src="@{/jQuery/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/js/bootstrap-dropdown.min.js}"></script>
    <script th:src="@{/js/addReader.js}"></script>

</head>


<script src="../js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>


<body class="bootstrap-admin-with-small-navbar">
<nav class="navbar navbar-inverse navbar-fixed-top bootstrap-admin-navbar bootstrap-admin-navbar-under-small"
     role="navigation">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="collapse navbar-collapse main-navbar-collapse">
                    <a class="navbar-brand" href="/manage/home"><strong>欢迎使用图书馆管理系统</strong></a>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" role="button" class="dropdown-toggle" data-hover="dropdown">
                                <i class="glyphicon glyphicon-user"></i> 欢迎您，<span th:text="${session.admin.username}"></span>
                                <i class="caret"></i></a>

                            <ul class="dropdown-menu">
                                <li><a href="#updateinfo" data-toggle="modal">个人资料</a></li>
                                <li role="presentation" class="divider"></li>
                                <li><a href="#updatepwd" data-toggle="modal">修改密码</a></li>
                                <li role="presentation" class="divider"></li>
                                <li><a href="/admin/quit">退出</a></li>
                            </ul>

                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
<input type="hidden" th:value="${msg}" id="msg"/>
<div class="container">
    <div class="row">
        <div class="col-md-2 bootstrap-admin-col-left">
            <ul class="nav navbar-collapse collapse bootstrap-admin-navbar-side">
                <li>
                    <a href="/manage/bookManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 图书管理</a>
                </li>
                <li>
                    <a href="/manage/bookTypeManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 图书分类管理</a>
                </li>


                <li>
                    <a href="/manage/borrowSearch"><i
                            class="glyphicon glyphicon-chevron-right"></i> 借阅查询</a>
                </li>


                <li>
                    <a href="/manage/adminManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 管理员管理</a>
                </li>

                <li>
                    <a href="/manage/readerManage"><i
                            class="glyphicon glyphicon-chevron-right"></i> 读者管理</a>
                </li>





            </ul>
        </div>

        <!-- content -->
        <div class="col-md-10">
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default bootstrap-admin-no-table-panel">
                        <div class="panel-heading">
                            <div class="text-muted bootstrap-admin-box-title">查询</div>
                        </div>
                        <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                            <form class="form-horizontal" action="/reader/reader_select"
                                  method="post">
                                <div class="col-lg-5 form-group">
                                    <label class="col-lg-4 control-label">证件号</label>
                                    <div class="col-lg-8">
                                        <input class="form-control" id="readerId" type="text" value="" name="paperNO">
                                        <label class="control-label" for="readerId" style="display: none;"></label>
                                    </div>
                                </div>
                                <div class="col-lg-5 form-group">
                                    <label class="col-lg-4 control-label" >姓名</label>
                                    <div class="col-lg-8">
                                        <input class="form-control" id="readerName" name="name" type="text" value="">
                                        <label class="control-label" for="readerName" style="display: none;"></label>
                                    </div>
                                </div>


                                <div class="col-lg-5 form-group">
                                    <label class="col-lg-4 control-label" >读者类型</label>
                                    <div class="col-lg-8">
                                        <select class="form-control" id="readerType" name="readerType.readerTypeId">
                                            <<option th:each="readerType:${session.readerTypes}" th:value="${readerType.readerTypeId}" th:text="${readerType.readerTypeName}"></option>
                                        </select>

                                    </div>
                                </div>

                                <div class="col-lg-1 form-group"></div>

                                <div class="col-lg-2 form-group">
                                    <button type="submit" class="btn btn-primary" id="btn_query" >查询
                                    </button>

                                </div>

                                <div class="col-lg-2 form-group">
                                    <button type="button" class="btn btn-primary" data-toggle="modal"
                                            data-target="#addModal">添加读者
                                    </button>
                                </div>


                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-lg-12">
                    <table id="data_list" class="table table-hover table-bordered" cellspacing="0" width="100%">
                        <thead>
                        <tr>
                            <th>读者证件号</th>
                            <th>读者姓名</th>
                            <th>读者类型</th>
                            <th>联系号码</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>



                        <tbody th:if="${readers != null}" th:each="reader:${readers}">
                        <td th:text="${reader.paperNO}">
                        </td>
                        <td th:text="${reader.name}">
                        </td>
                        <td th:text="${reader.readerType.readerTypeName}">
                        </td>
                        <td th:text="${reader.phone}">
                        </td>
                        <td th:data="${reader.createTime}">
                        </td>
                        <td>
                            <button type="button" class="btn btn-info btn-xs" data-toggle="modal"
                                    data-target="#findModal"  th:onclick="writevalue1([[${reader}]]);">查看</button>
                            <button type="button" class="btn btn-warning btn-xs" data-toggle="modal"
                                    data-target="#updateModal" th:onclick="writevalue([[${reader}]]);">修改</button>
                            <a th:href="@{'/reader/reader_delete?readerId='+${reader.readerId}}"><button type="button" class="btn btn-danger btn-xs"
                            >删除</button></a>

                        </td>
                        </tbody>


                    </table>



                </div>
            </div>


        </div>

        <!--------------------------------------添加的模糊框------------------------>
        <form class="form-horizontal" action="/reader/reader_insert">   <!--保证样式水平不混乱-->
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="myModalLabel">
                                添加新读者
                            </h4>
                        </div>
                        <div class="modal-body">

                            <!---------------------表单-------------------->
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者证件号</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="paperNO" id="addPaperNO" placeholder="请输入读者证件号">
                                    <label class="control-label" for="addPaperNO" style="display: none;"></label>
                                </div>
                            </div>


                            <div class="form-group">
                                <label  class="col-sm-3 control-label">真实姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="name" id="addName" placeholder="请输入读者真实姓名">
                                    <label class="control-label" for="addName" style="display: none;"></label>
                                </div>
                            </div>


                            <div class="form-group">
                                <label  class="col-sm-3 control-label">联系电话</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="phone" id="addPhone" placeholder="请输入读者联系电话">
                                    <label class="control-label" for="addPhone" style="display: none;"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label">邮箱</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="email" id="addEmail" placeholder="请输入读者邮箱">
                                    <label class="control-label" for="addEmail" style="display: none;"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者类型</label>
                                <div class="col-sm-7">
                                    <select class="form-control" name="readerType.readerTypeId" id="addreaderType">
                                        <<option th:each="readerType:${session.readerTypes}" th:value="${readerType.readerTypeId}" th:text="${readerType.readerTypeName}"></option>

                                    </select>
                                    <label class="control-label" for="addreaderType" style="display: none;"></label>
                                </div>
                            </div>

                            <!---------------------表单-------------------->
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                            <button type="submit" class="btn btn-primary" id="addReader">
                                添加
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </form>

        <!-- 修改模态框（Modal） -->
        <form class="form-horizontal" action="/reader/reader_update">   <!--保证样式水平不混乱-->
            <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="updateModalLabel">
                                修改读者信息
                            </h4>
                        </div>
                        <div class="modal-body">

                            <!---------------------表单-------------------->
                            <input type="hidden" name= "readerId" id="addReaderId" value="" >
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者证件号</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="updatePaperNO" name="paperNO" placeholder="请输入读者证件号">
                                    <label class="control-label" for="updatePaperNO" style="display: none;"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label">真实姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="updateName" name="name" placeholder="请输入读者真实姓名">
                                    <label class="control-label" for="updateName" style="display: none;"></label>
                                </div>
                            </div>


                            <div class="form-group">
                                <label  class="col-sm-3 control-label">联系电话</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="phone" id="updatePhone" placeholder="请输入读者联系电话">
                                    <label class="control-label" for="updatePhone" style="display: none;"></label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">邮箱</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" name="email" id="updateEmail" placeholder="请输入读者邮箱">
                                    <label class="control-label" for="updateEmail" style="display: none;"></label>
                                </div>
                            </div>


                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者类型</label>
                                <div class="col-sm-7">
                                    <select class="form-control" name="readerType.readerTypeId" id="updateReaderType">
                                        <<option th:each="readerType:${session.readerTypes}" th:value="${readerType.readerTypeId}" th:text="${readerType.readerTypeName}"></option>

                                    </select>
                                    <label class="control-label" for="updateReaderType" style="display: none;"></label>
                                </div>
                            </div>


                            <!---------------------表单-------------------->

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                            <button type="submit" class="btn btn-primary" id="updateReader">
                                修改
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </form>
        <form class="form-horizontal">   <!--保证样式水平不混乱-->
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="updatepwd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="myModalLabel">
                                修改密码
                            </h4>
                        </div>

                        <div class="modal-body">

                            <!--正文-->
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">原密码</label>
                                <div class="col-sm-7">
                                    <input type="password" class="form-control" id="oldPwd" placeholder="请输入原密码">
                                    <label class="control-label" for="oldPwd" style="display: none;"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label">新密码</label>
                                <div class="col-sm-7">
                                    <input type="password" class="form-control" id="newPwd" placeholder="请输入新密码">
                                    <label class="control-label" for="newPwd" style="display: none;"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label">确认密码</label>
                                <div class="col-sm-7">
                                    <input type="password" class="form-control" id="confirmPwd" placeholder="请输入确认密码">
                                    <label class="control-label" for="confirmPwd" style="display: none;"></label>
                                </div>
                            </div>
                            <!--正文-->


                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                            <button type="button" class="btn btn-primary" id="update_adminPwd">
                                修改
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </form>
        <!-------------------------------------------------------------->


        <!-------------------------个人资料模糊框------------------------------------->

        <form class="form-horizontal">   <!--保证样式水平不混乱-->
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="updateinfo" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="ModalLabel">
                                个人资料
                            </h4>
                        </div>

                        <div class="modal-body">

                            <!--正文-->
                            <div class="form-group">
                                <label class="col-sm-3 control-label">用户名</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="username"
                                           th:value='${session.admin.username}'>
                                    <label class="control-label" for="username" style="display: none;"></label>
                                </div>
                            </div>


                            <div class="form-group">
                                <label class="col-sm-3 control-label">真实姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="name" placeholder="请输入您的真实姓名"
                                           th:value="${session.admin.name}">
                                    <label class="control-label" for="name" style="display: none;"></label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系号码</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="phone" placeholder="请输入您的联系号码"
                                           th:value="${session.admin.phone}" >
                                    <label class="control-label" for="phone" style="display: none;"></label>

                                </div>
                            </div>

                            <!--正文-->


                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                            <button type="button" class="btn btn-primary" id="admin_updateInfo">
                                修改
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </form>
        <!-------------------------------------------------------------->


        <div class="modal fade" id="modal_info" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="infoModalLabel">提示</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12" id="div_info"></div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" id="btn_info_close" data-dismiss="modal">关闭
                        </button>
                    </div>
                </div>
            </div>
        </div>


        <!--------------------------------------查看的模糊框------------------------>
        <form class="form-horizontal">   <!--保证样式水平不混乱-->
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="findModal" tabindex="-1" role="dialog" aria-labelledby="findModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="findModalLabel">
                                查看读者信息
                            </h4>
                        </div>
                        <div class="modal-body">

                            <!---------------------表单-------------------->
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者证件号</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="findPaperNO" readonly="readonly">

                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="findReaderName" readonly="readonly">

                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-3 control-label">读者类型</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="findReaderType" readonly="readonly">

                                </div>
                            </div>


                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系号码</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="findPhone" readonly="readonly">

                                </div>
                            </div>


                            <div class="form-group">
                                <label  class="col-sm-3 control-label">邮箱</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="findEmail" readonly="readonly">

                                </div>
                            </div>


                            <!---------------------表单-------------------->
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </form>
        <!--------------------------------------查看的模糊框------------------------>


</body>
</html>
